class ApplicationController < ActionController::Base
  
  protect_from_forgery
  helper_method :current_user
  before_filter :logado?, :except => :login
    
  def index
  end
  
  def login
  end
  
  def logado?
    unless session[:funcionario_id]
      redirect_to login_path, :notice => "Usuário Inválido"
    end
  end
  
  private
  def current_user
    @current_user ||= Funcionario.find(session[:funcionario_id]) if session[:funcionario_id]
  end

end
